﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using DevExpress.XtraScheduler;

namespace Agnes.TaskManager
{
    /// <summary>
    /// XmlToRecurrenceInfoConverter
    /// </summary>
    public class XmlToRecurrenceInfoConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string xml = (string) value;
            RecurrenceInfo recurrenceInfo = new RecurrenceInfo();
            recurrenceInfo.FromXml(xml);
            return recurrenceInfo;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (value as RecurrenceInfo).ToXml();
        }
    }
}
